//
//  UIRelated.h
//  STM
//
//  Created by  xuchen(陈旭)， xichen(陈曦)， qq：511272827 on 10-10-21.
//  Copyright 2010 cc_team.com. All rights reserved.
//

#ifndef	CC_UI_RELATED
#define	CC_UI_RELATED

#include "CCAll.h"

#ifdef	OBJC_MACRO
#import <Foundation/Foundation.h>

//创建UI控件的宏
#define	UI_ALLOC_CREATE(UIctlName, x, y, width, height)	[[UIctlName alloc] initWithFrame:CGRectMake((x), (y), (width), (height))]
//#define	UI_ALLOC_CREATE_EX(UIctlName, POSITION)	[[UIctlName alloc] initWithFrame:CGRectMake((x), (y), (width), (height))]
#define	UI_RELEASE(UIctlName)						[UIctlName release]

//添加子view
#define	ADD_SUBVIEW(subView)						[self.view addSubview:(subView)]
#define	ADD_SUBVIEW_CTR(controller, subView)		[controller.view addSubview:(subView)]

//创建button
#define	CREATE_BUTTON()						[UIButton buttonWithType:UIButtonTypeRoundedRect]

//设置按钮标题
#define	SET_BUTTON_TITLE(btn, title)				[btn setTitle:title forState:UIControlStateNormal]
#define	setButtonTitle								SET_BUTTON_TITLE

#define	SET_BUTTON_TITLE_COLOR(btn, color)			[btn setTitleColor:color forState:UIControlStateNormal]
#define	setButtonTitleColor								SET_BUTTON_TITLE_COLOR

//添加按钮事件(一个参数的事件)
#define BUTTON_ADD_TARGET(btn, id, func, event)	[btn addTarget:id action:func forControlEvents:event]
//添加按钮事件(事件是两个参数)   it still has bug now! added by xuchen(陈旭)， xichen(陈曦)， qq：511272827 2010-10-28 17:09
//#define BUTTON_ADD_TARGET_TWO_ARGS(btn, id, func, event)	[btn addTarget:id action:func forControlEvents:event]
//添加按钮基本的触摸事件
#define BUTTON_ADD_COMMON_TARGET(btn, func)			[btn addTarget:self action:func forControlEvents:UIControlEventTouchUpInside]

//屏幕宽度和高度
#define	SCREEN_WIDTH	([[UIScreen mainScreen] bounds].size.width)
#define	SCREEN_HEIGHT	([[UIScreen mainScreen] bounds].size.height)

@interface UIRelated : NSObject 
{

}

//等待图标
//创建系统等待状态图标
+ (UIActivityIndicatorView *)createWaitingIcon:(CGRect)rect;

//显示系统的昂带状态图标
+ (void)showWaitingIcon:(UIActivityIndicatorView *)waitingIcon;

//隐藏系统的昂带状态图标
+ (void)hideWaitingIcon:(UIActivityIndicatorView *)waitingIcon;


//UITextView
//获取UITextView的ContentSize的宽度（N.B: 这不是界面上看到的控件的宽度，是可滚动后的宽度）
+ (CGFloat)getUITextViewContentWidth:(UITextView *)textView;

//获取UITextView的ContentSize的高度（N.B: 这不是界面上看到的控件的高度，是可滚动后的高度）
+ (CGFloat)getUITextViewContentHeight:(UITextView *)textView;


//UIView
//设置UIView的Frame的Y坐标
+ (CGFloat)setUIViewYValue:(UIView *)view withYValue:(CGFloat)yValue;

//设置UIView的Frame的高度
+ (CGFloat)setUIViewHeight:(UIView *)view withHeight:(CGFloat)newHeight;

@end

#endif	//OBJC_MACRO
#endif	//CC_UI_RELATED
